<%@page contentType="text/html" import="java.util.*,merlin.managers.*,merlin.utils.*"%>
<html>
	<head>
		<title>Industry Sectors</title>
	    <style type="text/css">
    		table{FONT:11px arial, verdana, sans-serif;vertical-align:top}
    		td{vertical-align:top}
	    </style>

		<script>
			function toggleIndustries(frm,bState){
				for(var i=0;i<frm.chkIndustry.length;i++){
					frm.chkIndustry[i].checked = bState;
				}
			}

			function submitPage(frm){
				var selectedSectors = "";
				for(var i=0;i<frm.chkIndustry.length;i++){
					if(frm.chkIndustry[i].checked){
      					selectedSectors += "," + frm.chkIndustry[i].value;
					}
				}
				if(selectedSectors.length > 0){
					frm.hidIndustrySector.value = selectedSectors.substring(1);
					return true;
				}else{
					alert("At least one industry sector must be selected");
					return false;
				}
			}
		</script>
	</head>
	<body>
		<center>
			<form method="post" action="industryWatch" onsubmit="return submitPage(this)">
				<input type="hidden" name="mode" value="navigateToView">
				<input type="hidden" name="viewFrom" value="0">
				<input type="hidden" name="viewTo" value="1">
				<input type="hidden" name="hidIndustrySector" value="">

				<div id="divIndustrySector" label = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" style="height:450px;width:750px;border-style:solid;border-width:1px;">
				    <table width='100%'>
				    	<tr>
				    		<td align="left">
								<input type="button" value="Select All" align="left" onclick="toggleIndustries(this.form,true)">
								<input type="button" value="Clear All" onclick="toggleIndustries(this.form,false)" >
							</td>
				    		<td align="right">
								<input type="button" value="Print Summary">
							</td>
				    	</tr>
				    </table>
				    <p/>
				    <div style="overflow:auto;height:340px;width:750px;border:thin">
						<%
							String tables = (String)application.getAttribute("reportTitlesTable");
							if(tables == null){
								tables = ReportTitlesManager.getReportsTable();
								application.setAttribute("reportTitlesTable",tables);
							}

							out.println(tables);
						%>
					</div>
				</div>
				<input type="submit">
			</form>
		</center>
	</body>
</html>